package cn.admin.remoting;


import org.apache.mina.common.IoFutureListener;
import org.apache.mina.common.WriteFuture;

import java.util.List;

public interface Connection {

    String CREATE_TIME = "createTime";
    String CREATE_STACK = "createStack";
    String CREATE_THREAD = "createThread";
    String CREATE_PROCESSOR = "createProcessor";
    String INIT_CLOSE = "initClose";
    String META_URL = "ClientUrl";
    String CLOSE_REASON = "closeConnReason";

    boolean isConnected();

    int getRemotePort();

    String getRemoteAddress();

    String getRemoteSocket();

    int getLocalPort();

    String getLocalAddress();

    String getLocalSocket();

    boolean isClientSide();

    Client getClient();

    ConnectionFactory getConnectionFactory();

    byte lastRequestProtocol();

    @Deprecated
    void close();

    void close(String cause);

    @Deprecated
    void write(Object connectionMsg);

    WriteFuture write(Object connectionMsg, IoFutureListener wfl);

    void addConnectionEvtListener(IOEventListener listener);

    void removeConnectionEvtListener(IOEventListener listener);

    List<IOEventListener> getConnectionEvtListeners();

    <T> T setAttribute(String key, T value);

    <T> T getAttribute(String key);

    <T> T removeAttribute(String key);

}
